home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / AIAT 1.0.1 / Headers / Storage / HFSStoreStream.h < prev    next >
Encoding:
Text File  |  1997-09-11  |  1.9 KB  |  81 lines  |  [TEXT/CWIE]

  1. // HFSStoreStream.h
  2. //    Copyright:    © 1994 - 1996 by Apple Computer, Inc., all rights reserved.
  3.  
  4.  
  5. // Implements IAStoreStream for a Macintosh HFS file.
  6.  
  7. #pragma once
  8. #ifndef HFSStoreStream_h
  9. #define HFSStoreStream_h
  10.  
  11. #pragma import on
  12.  
  13. #include "IAStoreStream.h"
  14.  
  15. //#pragma IA_BEGIN_IMPORTS
  16. #include <Files.h>
  17. //#pragma IA_END_IMPORTS
  18.  
  19. #pragma IA_BEGIN_EXPORTS
  20.  
  21. class HFSStoreStream : public IAStoreStream {
  22. public:
  23.             HFSStoreStream(short vRef, long dirId, const StringPtr fileName,
  24.                            OSType creator = 'VTWN', OSType fileType = 'STOR');
  25.             ~HFSStoreStream();
  26.  
  27.     void            Initialize();
  28.     void            Open(bool writable);
  29.  
  30.     bool            IsOpen();
  31.     bool            IsWritable();
  32.  
  33.     void            Flush();
  34.  
  35.     uint32            GetEOF();
  36.     void            SetEOF(uint32 address);
  37.  
  38.     virtual IAStoreStream*    Clone();
  39.     
  40.     OSType            GetCreator() const {return creator;}
  41.     OSType            GetFileType() const {return fileType;}
  42.     const short        GetVRefNum() const {return vRefNum;}
  43.     const long        GetDirID() const {return dirID;}
  44.     StringPtr        GetFileName() const {return fileName;}
  45.     short            GetFRefNum() const {return fRefNum;}
  46.     void            SetFRefNum(short fref) {fRefNum = fref;}  // better be open!
  47.     
  48. protected:
  49.             // constructor for use by Clone()
  50.             HFSStoreStream(short vRef, long dirId, const StringPtr fileName,
  51.                            OSType creator, OSType fileType, bool isOpen, bool isWritable,
  52.                            short fRefNum);
  53.  
  54.     void            Write(uint32 address, const byte* data, uint32 length);
  55.     uint32            Read(uint32 address, byte* data,  uint32 length);
  56.  
  57. private:
  58.                     HFSStoreStream(HFSStoreStream&);    // don't define a copy constructor
  59.  
  60.     bool            isOpen;
  61.     bool            isWritable;
  62.     const bool        isClone;
  63.  
  64.     // for use by Initialize()
  65.     const OSType    creator;
  66.     const OSType    fileType;    
  67.     // for use by Initialize() and Open()
  68.     const short        vRefNum;
  69.     const long        dirID;
  70.     StringPtr         fileName;
  71.     // handle on the open file, for remaining methods
  72.     short            fRefNum;
  73.  
  74. };
  75.  
  76. #pragma IA_END_EXPORTS
  77.  
  78. #pragma import reset
  79.  
  80. #endif
  81.